<template>
    <el-main>
      <h3>商品列表</h3>
      <template>
        <el-table
          :data="tableData"
          stripe
          style="width: 100%">
          <el-table-column prop="id" label="Id"></el-table-column>
          <el-table-column prop="title" label="名称"></el-table-column>
          <el-table-column prop="price" label="价格"></el-table-column>
          <el-table-column prop="images" label="图片"></el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                @click="addMiao(scope.row)">秒杀</el-button>
            </template>
          </el-table-column>

        </el-table>
      </template>
    </el-main>
</template>

<script>
  import { getGoodsList } from "@/api/miaosha/miaosha";
    export default {
        name: "index",
      data() {
        return {
          tableData:[],
          queryForm:{
            pageNum:1,
            pageSize:10
          }
        }
      },created() {
          this.list();
      },
      methods:{
        addMiao(row) {
          console.log(row);
            this.$router.push({
              path:"miaoadd",
              query:{
                formDate:{
                  id:row.id,
                  title:row.title,
                },
              }
            })
        },
        list(){
          getGoodsList(this.queryForm).then(res=>{
            this.tableData=res.rows;
            console.log(res);
          })
        }
      }
    }
</script>

<style scoped>

</style>
